﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using BLO;

namespace QuanLyBanHang
{
    public partial class frmBaoCaoSP : Form
    {
        public frmBaoCaoSP()
        {
            InitializeComponent();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Dispose(true);
            this.Close();
        }

        private void btnTim_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cbbNhanVien.SelectedValue.ToString()) || string.IsNullOrEmpty(cbbKH.SelectedValue.ToString()))
                return;
            string manv = cbbNhanVien.SelectedValue.ToString();
            string makh = cbbKH.SelectedValue.ToString();
            dgvResult.DataSource = new SanPham_Blo().GetSanPhams(makh, manv);
        }

        private void btnTaoBC_Click(object sender, EventArgs e)
        {
            
        }

        private void cbbKH_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbbNhanVien.Enabled = true;
        }

        private void frmBaoCaoSP_Load(object sender, EventArgs e)
        {
            Utility.ComboboxUlt.LoadData(new KhachHang_Blo().GetAllObject(), cbbKH, new[] { "MaKH", "MaKH" }, "Chọn khách hàng");
            Utility.ComboboxUlt.LoadData(new NhanVien_Blo().GetAllObject(), cbbNhanVien, new[] { "TenNV", "MaNV" }, "Chọn nhân viên");
            cbbKH.SelectedIndex = 1;
        }
    }
}
